package com.houserent.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.houserent.entry.HouseResult;
import com.houserent.service.LoginService;

@RequestMapping("/login")
@Controller
public class LoginController {

    @Resource
    private LoginService login;

    @ResponseBody
    @RequestMapping("/login.do")
    public HouseResult logIn(String userName, String password) {
        return login.logIn(userName, password);
    }

    @ResponseBody
    @RequestMapping("/register.do")
    public HouseResult register(String userName, String password, String telPhone, String userType) {
        return login.register(userName, password, telPhone, userType);
    }

    @ResponseBody
    @RequestMapping("/modifyUserInfo.do")
    public HouseResult modifyUserInfo(String userId, String linkPhone, String realName, String sex, String certNum,
            String email, String qq, String fullTag) {
        return login.modifyUserInfo(userId, linkPhone, realName, sex, certNum, email, qq, fullTag);
    }

    @ResponseBody
    @RequestMapping("/modifypwd.do")
    public HouseResult modifypwd(String userId, String oldPwd, String newPwd) {
        return login.modifypwd(userId, oldPwd, newPwd);
    }

    @ResponseBody
    @RequestMapping("/qryAllUserByhostId.do")
    public HouseResult qryAllUserByhostId(String hostId) {
        return login.qryAllUserByhostId(hostId);
    }

}
